<?php
declare (strict_types=1);

use think\facade\Route;

//miss路由，定义404
Route::miss(function () {
    @header("http/1.1 404 not found");
    @header("status: 404 not found");
    exit();
});

//首页
Route::group('index', function () {
    Route::get('/index', 'index/index');
    Route::get('/test', 'index/test');
    Route::get('/communal', 'index/communal');
    Route::get('/carousel', 'index/carousel');
    Route::get('/inquiryUser', 'index/inquiryUser');
    Route::get('/info', 'index/info');
});

//银行
Route::group('bank', function () {
    Route::get('/index', 'bank/index');
});

//省市区街道联动
Route::group('area', function () {
    Route::get('/index', 'area/index');
});

//发送短信验证码
Route::group('userCode', function () {
    Route::post('/sendSms', 'userCode/sendSms');
});

//上传
Route::group('uploads', function () {
    Route::post('/uploadImage', 'uploads/uploadImage');
    Route::post('/uploadVideo', 'uploads/uploadVideo');
    Route::post('/uploadFile', 'uploads/uploadFile');
});

//公告
Route::group('news', function () {
    Route::get('/index', 'news/index');
    Route::get('/info', 'news/info');
});

//注册
Route::group('register', function () {
    Route::post('/index', 'register/index');
});

//登录
Route::group('login', function () {
    Route::post('/index', 'login/index');
    Route::post('/wechatAuth', 'login/wechatAuth');
    Route::post('/verifyCode', 'login/verifyCode');
});

//找回密码
Route::group('retrieve', function () {
    Route::post('/index', 'retrieve/index');
});

//安全中心
Route::group('security', function () {
    Route::get('/index', 'security/index');
    Route::post('/save', 'security/save');
})->middleware('verify');

//个人中心
Route::group('user', function () {
    Route::get('/index', 'user/index');
    Route::get('/info', 'user/info');
    Route::post('/edit', 'user/edit');
    Route::get('/myTeamTotal', 'user/myTeamTotal');
    Route::get('/myTeamList', 'user/myTeamList');
})->middleware('verify');

//账户相关
Route::group('account', function () {
    Route::get('/index', 'account/index');
})->middleware('verify');

//签到
Route::group('sign', function () {
    Route::get('/index', 'sign/index');
    Route::post('/add', 'sign/add');
})->middleware('verify');

//抽奖
Route::group('raffle', function () {
    Route::get('/index', 'raffle/index');
    Route::post('/submit', 'raffle/submit');
    Route::get('/record', 'raffle/record');
})->middleware('verify');

//收货地址
Route::group('address', function () {
    Route::get('/index', 'address/index');
    Route::get('/info', 'address/info');
    Route::post('/save', 'address/save');
    Route::post('/setDefault', 'address/setDefault');
    Route::post('/delete', 'address/delete');
})->middleware('verify');

//收款方式
Route::group('method', function () {
    Route::get('/index', 'method/index');
    Route::get('/info', 'method/info');
    Route::post('/save', 'method/save');
})->middleware('verify');

//充值相关
Route::group('remit', function () {
    Route::get('/index', 'remit/index');
    Route::post('/save', 'remit/save');
    Route::get('/record', 'remit/record');
})->middleware('verify');

//提现相关
Route::group('draw', function () {
    Route::get('/index', 'draw/index');
    Route::post('/save', 'draw/save');
    Route::get('/record', 'draw/record');
})->middleware('verify');

//转账相关
Route::group('transfer', function () {
    Route::get('/index', 'transfer/index');
    Route::post('/save', 'transfer/save');
    Route::get('/record', 'transfer/record');
})->middleware('verify');

//转换相关
Route::group('exchange', function () {
    Route::get('/index', 'exchange/index');
    Route::post('/save', 'exchange/save');
    Route::get('/record', 'exchange/record');
})->middleware('verify');

//留言反馈相关
Route::group('message', function () {
    Route::get('/index', 'message/index');
    Route::post('/save', 'message/save');
})->middleware('verify');

//消息通知
Route::group('notify', function () {
    Route::get('/index', 'notify/index');
    Route::get('/info', 'notify/info');
})->middleware('verify');

//商品分类相关
Route::group('productCate', function () {
    Route::get('/index', 'productCate/index');
});

//商品相关
Route::group('product', function () {
    Route::get('/index', 'product/index');
    Route::get('/info', 'product/info');
    Route::get('/getSpecInfo', 'product/getSpecInfo');
    Route::post('/submit', 'product/submit')->middleware('verify');
});

//购物车
Route::group('cart', function () {
    Route::get('/index', 'cart/index');
    Route::post('/add', 'cart/add');
    Route::post('/edit', 'cart/edit');
    Route::post('/submit', 'cart/submit');
})->middleware('verify');

//订单
Route::group('order', function () {
    Route::get('/getTemporary', 'order/getTemporary');
    Route::post('/submit', 'order/submit');
    Route::get('/payment', 'order/payment');
    Route::post('/confirmPayment', 'order/confirmPayment');
    Route::get('/index', 'order/index');
    Route::get('/info', 'order/info');
    Route::post('/edit', 'order/edit');
})->middleware('verify');
